<template>
	<div class="page soleKanban-page" data-page="soleKanban" style="overflow: hidden;z-index: 2;">
		<div class="link-page-nav">
			<a href="#" class="link" @click="$root.backToTab()" id="btn_soleKanbanBack">
				<i class="iconfont icon-zuo"></i>
			</a>
		</div>
		<div class="link-page-top">
			<div class="tt  top-one" id="orgName_soleKanban"></div>
			<div class="link-page-title top-two" style="display:none;">
				<span class="orgNameTitle2" id="orgNameTitle2"></span>
				<span id="rightScoreNum" class="rightScoreNum"></span>
			</div>
		</div>
		<div class="page-content soleKanban-page-content ptr-content" @ptr:refresh="refreshCards" id="kanban-page-content">
			<div class="ptr-preloader home-top-refresh" style="top: 30px;">
				<div class="preloader color-multi"></div>
				<div class="ptr-arrow"></div>
			</div>
			<div class="soleKanban-top">
				<div class="number-text">
					<div class="num" id="scoreNum"></div>
					<div class="text" id="scoreDesc"></div>
				</div>
				<div class="soleKanban-top-t t turn-rotate"></div>
				<div class="soleKanban-top-t b "></div>
			</div>
			<div class="rippleAnimation">
				<ul class="list" id="soleKanban_dataList"></ul>
				<div class="itemView" style="margin-top:70px;">
					<div class="score">得分计算<span>总分&nbsp;<label>100</label></span></div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	return {
		data: function () {
			return {
				singleOrgId: userInfor.organizationIds,
				swipeBox: {}
			}
		},
		methods: {
			//刷新
			refreshCards: function (e, done) {
				let self = this;
				let $ = self.$$;
				if (1 === e) {
					common.loading(1);
				} else {
					$(".home-top-refresh").show();
				}
				if (done && e) {
					setTimeout(function () {
						self.swipeBox = {};
						$("#soleKanban_dataList").html('');
						$(".itemView").html('');
						$(".itemView").append('<div class="score">得分计算<span>总分&nbsp;<label>100</label></span></div>');
						self.getScoreItemDetail();
						self.handleScroll();

						done();
						if (1 === e) {
							common.loading(0);
						} else {
							$(".home-top-refresh").hide();
						}
					}, 1000);
				}
			},
			//获取安全指数得分明细
			getScoreItemDetail: function () {
				var self = this;
				if (single_Orgid) {
					self.singleOrgId = single_Orgid;
				}
				Dao.getScoreItemDetail({
					orgId: self.singleOrgId,
				}, function (data, total) {
					if (data != null) {
						var score = data.score;//总分
						var safetyRecordId = data.safetyRecordId;
						var deductUseScore = data.deductUseScore;//剔除重复扣分
						//切换动画背景
						self.getColorBg(score);
						$("#rightScoreNum").html(score);
						$("#scoreNum").html(score);
						$("#scoreDesc").html(self.getColorByScore(score, false));
						for (var key in data) {
							if (!isNaN(key)) {
								var obj = data[key];
								var groupName = obj.groupName;//单位名称;
								var groupId = obj.groupId;//单位分组id
								var value = obj.value;
								var majorDeduct = obj.value;
								if (majorDeduct == 0) {
									majorDeduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
								} else {
									majorDeduct = "-" + majorDeduct;
								}
								if (value == 0) {
									$(".itemView").append(`<div class="item"><span>` + groupName + `</span><label style="color:#69BA71"><i class="iconfont icon-duigou"></i></label></div>`);
								} else {
									$(".itemView").append(`<div class="item"><span>` + groupName + `</span><label style="color:#E96D55">-` + value + `</label></div>`);
								}
								var titleHtml = `<img src="` + obj.groupIco + `"/>
																<div id="groupTitleDiv`+ groupId + `">
																	<p class="unit-tt">`+ groupName + `<span>` + majorDeduct + `</span></p>
																	<p class="unit-des"></p>
																</div>`;
								$("#soleKanban_dataList").append(`<li class="unit" id="groupDiv`+ groupId + `">
																										`+ titleHtml + `
																									</li>`);
								self.getSafetyGroup(safetyRecordId, obj.groupId);
							}
						}
						if (deductUseScore == 0) {
							$(".itemView").append(`<div class="item"><span>剔除重复扣分</span><label style="color:#69BA71"><i class="iconfont icon-duigou"></i></label></div>`);
						} else {
							$(".itemView").append(`<div class="item"><span>剔除重复扣分</span><label style="color:rgba(105, 186, 113, 1)">+` + deductUseScore + `</label></div>`);
						}
						$(".itemView").append(`
                            <div class="line"></div>
                            <div class="score">统计得分<span id="total">`+ score + `</span></div>
                            <div class="linkView">
                                <span id="evaluationBasis" style="margin-right: 64px;"><i class="iconfont icon-renzhengpinggu"></i>评估申明</span>
                                <span id="disclaimer"><i class="iconfont icon-toubaoshengming"></i>免责申明</span>
                            </div>
                        `);
						jQuery("#evaluationBasis").click(function (e) {
							self.explainTip(1);
						});
						jQuery("#disclaimer").click(function (e) {
							self.explainTip(2);
						});
					}
				});
			},
			//获取安全指数得分明细
			getSafetyGroup: function (safetyRecordsId, groupId) {
				var self = this;
				Dao.getSafetyGroup({
					orgId: self.singleOrgId,
					groupId: groupId,
					safetyRecordsId: safetyRecordsId,
				}, function (data, total) {
					if (data) {
						var majorDeduct = data.deduct;
						var majorGroupId = data.groupId;//1：消防设施单元2：安全疏散设施单元3：消防安全管理单元 4：建筑防火单元5：客观隐患 6：直接判定项
						var majorGroupName = data.groupName;
						var majorTitle = data.title;//设备和扣分项标题
						var detailList = data.details;
						var majorIcon = data.groupIcon;
						// if (majorDeduct == 0) {
						// 	majorDeduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
						// } else {
						// 	majorDeduct = "-" + majorDeduct;
						// }
						// var titleHtml = `<img src="` + majorIcon + `"/>
            //                         <div id="groupTitleDiv`+ majorGroupId + `">
            //                         <p class="unit-tt">`+ majorGroupName + `<span>` + majorDeduct + `</span></p>
            //                         <p class="unit-des">`+ majorTitle + `</p>
            //                     </div>`;
						var detailHtml = "";
						var detailHtml1 = "";
						if (detailList != null) {
							detailHtml = `<ul class="level2ui" id="groupUl` + majorGroupId + `">`;
							//detailHtml1="<ul  class='item-list'>";
							var indexItem = 0;
							for (var i = 0; i < detailList.length; i++) {
								var deduct = detailList[i].deduct;//每个消防系统扣除分数
								var deductNum = detailList[i].deductNum;//
								var deviceNum = detailList[i].deviceNum;//
								var icon = detailList[i].icon;//
								var name = detailList[i].name;//
								var objid = detailList[i].objId;//
								var title = detailList[i].title;//
								var deductDetails = detailList[i].deductDetails;//

								if (objid == 1 || objid == 3 || objid == 12 || objid == 13) {
									detailHtml = detailHtml.replace('level2ui', 'item-list');
								}

								if (deduct == 0) {
									deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
								} else {
									deduct = "-" + deduct;
								}

								if (objid == 1) {//消控室值班(消控室人员值守分析)
									++indexItem;
									detailHtml += `<li style="padding-bottom: 19px;">
				        	        				<div class="item-tt">
				    	        					<img src="`+ icon + `"/><span>` + name + `</span><label>` + deduct + `</label>
				    	        					<p>`+ title + `</p>
				    	        				</div>`;
									if (deductDetails.length > 0) {
										detailHtml += `<div  id="item_swiper_` + majorGroupId + '_' + indexItem + `_` + objid + `"  class="swiper-container swiper-video" ><div class="swiper-wrapper">`;
									}
									for (var j = 0; j < deductDetails.length; j++) {
										var deductDetail = deductDetails[i];
										var level3Deduct = detailList[i].deduct;
										if (level3Deduct == 0) {
											level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
										} else {
											level3Deduct = "-" + level3Deduct;
										}
										detailHtml += `<div class="swiper-slide" style="background-color: transparent;">
											    	<div class="item-video">
							        					<img src="`+ picNo(deductDetail.picUrl) + `"/>
														<div class="item-void-tt">
															<span>`+ detailList[i].name + `</span>
															<label>`+ level3Deduct + `</label>
														</div>
														<div class="item-void-tt">
															`+ deductDetail.fireTTypeName + `&nbsp;&nbsp;已持续` + deductDetail.keepTime + `
														</div>
							        				</div>
											    </div>`;
									}
									if (deductDetails.length > 0) {
										detailHtml += `</div>
				          							  <div class="line"></div>
				        							  <div class="swiper-pagination" id="item_pagination_`+ majorGroupId + '_' + indexItem + `_` + objid + `"  style="bottom:3px"></div>
				        							</div>`;
									}
									detailHtml += `</li>`;
								} else if (objid == 2) {//日常巡检
									detailHtml += `<li>
		                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
		                                        <div>
		                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
		                                        <p class="level2-item-des">`+ title + `</p>
		                                    </div></li>`;
								} else if (objid == 3) {//隐患整改
									++indexItem;
									detailHtml += `<li style="padding-bottom: 19px;">
				        	        				<div class="item-tt">
				    	        					<img src="`+ icon + `"/><span>` + name + `</span><label>` + deduct + `</label>
				    	        					<p>`+ title + `</p>
				    	        				</div>`;
									if (deductDetails.length > 0) {
										detailHtml += `<div id="item_swiper_` + majorGroupId + '_' + indexItem + `_` + objid + `" data-speed="900" 
											data-pagination='{"el": ".swiper-pagination"}' 
											data-space-between="50" 
											class="swiper-container swiper-init demo-swiper swiper-video" >
										<div class="swiper-wrapper">`;
									}
									for (var j = 0; j < deductDetails.length; j++) {
										var deductDetail = deductDetails[j];
										var level3Deduct = deductDetail.deduct;
										var level3Status = deductDetail.status;
										if (level3Deduct == 0) {
											level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
										} else {
											level3Deduct = "-" + level3Deduct;
										}
										//1:整改中、2:已完成，3:核实中，5:待指派
										if (level3Status == 1) {
											level3Status = "整改中";
										} else if (level3Status == 2) {
											level3Status = "已完成";
										} else if (level3Status == 3) {
											level3Status = "审核中";
										} else if (level3Status == 5) {
											level3Status = "待指派";
										} else {
											level3Status = "-";
										}
										detailHtml += `<div class="swiper-slide" style="background-color: transparent;">
											    	<div class="item-video">
							        					<img src="`+ picNo(deductDetail.picUrls.split(",")[0]) + `"/>
														<div class="item-void-tt">
															<span>`+ deductDetail.gradeName + `</span>
															<span class="video-status">`+ level3Status + `</span>
															<label>`+ level3Deduct + `</label>
														</div>
							        					<p class="item-void-des">`+ deductDetail.hiddenDangerDesc + `</p>
							        				</div>
											    </div>`;
									}
									if (deductDetails.length > 0) {
										detailHtml += `</div>
				          					<div class="line"></div>
				        					<div class="swiper-pagination" id="item_pagination_`+ majorGroupId + '_' + indexItem + `_` + objid + `" style="bottom:3px"></div>
				        				</div>`;
									}
									detailHtml += `</li>`;
								} else if (objid == 4) {//维保巡查
									var unCompleteCount = 0;
									var taskListHtml = "";
									if (deductDetails.length > 0) {
										var taskListHtml = `<div class="line"></div>`;
										for (var j = 0; j < deductDetails.length; j++) {
											var beforeDeductDetail = deductDetails[j].before;
											unCompleteCount = beforeDeductDetail.unCompleteCount;
											var level3DetailList = beforeDeductDetail.details;
											for (var n = 0; n < level3DetailList.length; n++) {
												if (level3DetailList[n].isDeduct == 0) {
													continue;
												}
												var level3Deduct = level3DetailList[n].deduct;
												var level3Percent = level3DetailList[n].percent;
												var level3TaskName = level3DetailList[n].taskName;
												var percentage = "0%";
												let percentageRealNum = 100;
												let percentageNum = Math.round(parseInt(level3Percent).toFixed(2) * 100);
												if (!isNaN(percentageNum)) {
													percentageRealNum = percentageNum - 100;
													percentage = Math.round(parseInt(level3Percent).toFixed(2) * 100).toString() + "%";
												}
												if (level3Deduct == 0) {
													level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
												} else {
													level3Deduct = "-" + level3Deduct;
												}
												taskListHtml += `<div>
    					                                    	<div class="item-task">
    						                                    	<span class="taskTitle">`+ level3TaskName + `</span>
    						                                    	<label class="deduct">`+ level3Deduct + `</label>
    					                                    	</div>
    					                                    	<div class="item-task-percent">
    						                                    	<div data-progress="80" class="progressbar progressbar-height">
    								                                    <span style="transform: translate3d(`+ percentageRealNum + `%, 0px, 0px);"></span>
    								                                 </div>
    						                                    	<label class="percent">`+ percentage + `</label>
    					                                    	</div>
    				                                    	</div>`;
											}
										}
									}
									detailHtml += `<li>
		                                    <img style="width:22px;height:22px;" src="`+ icon + `"/>
		                                        <div>
		                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
		                                        <p class="level2-item-des">上期共有`+ unCompleteCount + `个维保巡查任务未完成</p>
		                                    </div>
		                                    `+ taskListHtml + `
		                                    </li>`;
								} else if (objid == 5) {//保养
									var unCompleteCount = 0;
									var taskListHtml = "";
									if (deductDetails.length > 0) {
										var taskListHtml = `<div class="line"></div>`;
										for (var j = 0; j < deductDetails.length; j++) {
											var beforeDeductDetail = deductDetails[j].before;
											unCompleteCount = beforeDeductDetail.unCompleteCount;
											var level3DetailList = beforeDeductDetail.details;
											for (var n = 0; n < level3DetailList.length; n++) {
												if (level3DetailList[n].isDeduct == 0) {
													continue;
												}
												var level3Deduct = level3DetailList[n].deduct;
												var level3Percent = level3DetailList[n].percent;
												var level3TaskName = level3DetailList[n].taskName;
												var percentage = "0%";
												let percentageRealNum = 100;
												let percentageNum = Math.round(parseInt(level3Percent).toFixed(2) * 100);
												if (!isNaN(percentageNum)) {
													percentageRealNum = percentageNum - 100;
													percentage = Math.round(parseInt(level3Percent).toFixed(2) * 100).toString() + "%";
												}
												if (level3Deduct == 0) {
													level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
												} else {
													level3Deduct = "-" + level3Deduct;
												}
												taskListHtml += `<div>
						                                    	<div class="item-task">
							                                    	<span class="taskTitle">`+ level3TaskName + `</span>
							                                    	<label class="deduct">`+ level3Deduct + `</label>
						                                    	</div>
						                                    	<div class="item-task-percent">
							                                    	<div data-progress="80" class="progressbar progressbar-height">
									                                    <span style="transform: translate3d(`+ percentageRealNum + `%, 0px, 0px);"></span>
									                                 </div>
							                                    	<label class="percent">`+ percentage + `</label>
						                                    	</div>
					                                    	</div>`;
											}
										}
									}
									detailHtml += `<li>
		                                    <img style="width:22px;height:22px;" src="`+ icon + `"/>
		                                        <div>
		                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
		                                        <p class="level2-item-des">上期共有`+ unCompleteCount + `个保养任务未完成</p>
		                                    </div>
		                                    `+ taskListHtml + `
		                                    </li>`;
								} else if (objid == 6) {//单点测试
									var unCompleteCount = 0;
									var taskListHtml = "";
									if (deductDetails.length > 0) {
										var taskListHtml = `<div class="line"></div>`;
										for (var j = 0; j < deductDetails.length; j++) {
											var beforeDeductDetail = deductDetails[j].before;
											unCompleteCount = beforeDeductDetail.unCompleteCount;
											var level3DetailList = beforeDeductDetail.details;
											for (var n = 0; n < level3DetailList.length; n++) {
												if (level3DetailList[n].isDeduct == 0) {
													continue;
												}
												var level3Deduct = level3DetailList[n].deduct;
												var level3Percent = level3DetailList[n].percent;
												var level3TaskName = level3DetailList[n].taskName;
												var percentage = "0%";
												let percentageRealNum = 100;
												let percentageNum = Math.round(parseInt(level3Percent).toFixed(2) * 100);
												if (!isNaN(percentageNum)) {
													percentageRealNum = percentageNum - 100;
													percentage = Math.round(parseInt(level3Percent).toFixed(2) * 100).toString() + "%";
												}
												if (level3Deduct == 0) {
													level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
												} else {
													level3Deduct = "-" + level3Deduct;
												}
												taskListHtml += `<div>
						                                    	<div class="item-task">
							                                    	<span class="taskTitle">`+ level3TaskName + `</span>
							                                    	<label class="deduct">`+ level3Deduct + `</label>
						                                    	</div>
						                                    	<div class="item-task-percent">
							                                    	<div data-progress="80" class="progressbar progressbar-height">
									                                    <span style="transform: translate3d(`+ percentageRealNum + `%, 0px, 0px);"></span>
									                                 </div>
							                                    	<label class="percent">`+ percentage + `</label>
						                                    	</div>
					                                    	</div>`;
											}
										}
									}
									detailHtml += `<li>
		                                    <img style="width:22px;height:22px;" src="`+ icon + `"/>
		                                        <div>
		                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
		                                        <p class="level2-item-des">上期共有`+ unCompleteCount + `个单点测试任务未完成</p>
		                                    </div>
		                                    `+ taskListHtml + `
		                                    </li>`;
								} else if (objid == 7) {//联动测试
									var unCompleteCount = 0;
									var taskListHtml = "";
									if (deductDetails.length > 0) {
										var taskListHtml = `<div class="line"></div>`;
										var beforeDeductDetail = deductDetails[0].before;
										unCompleteCount = beforeDeductDetail.unCompleteCount;
										var detailsList = beforeDeductDetail.details;
										for (var j = 0; j < detailsList.length; j++) {
											if (detailsList[j].isDeduct == 0) {
												continue;
											}
											var level4Deduct = detailsList[j].deduct;
											var level4Percent = detailsList[j].percent;
											var level4taskId = detailsList[j].taskId;
											if (level4Deduct == 0) {
												level4Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
											} else {
												level4Deduct = "-" + level4Deduct;
											}
											var taskStatus = "未开展";
											if (level4Percent > 0) {
												taskStatus = "未完成";
											} else if (level4Percent == 100) {
												taskStatus = "已完成";
											}
											taskListHtml += `<div class="chartView">
			                					<div class="mCharts" id="mCharts_`+ level4taskId + `_` + level4Percent + `"></div>
				                					<div class="mCharts_per">`+ level4Percent + `%</div>
				        	        				<div style="margin-top: -5px;">
				        	        					<div class="item-tt"><span>`+ detailsList[j].taskName + `</span><label>` + level4Deduct + `</label></div>
				        	        					<div class="chart-status" style="color:#2E76CA;">`+ taskStatus + `</div>
				        	        				</div>
				                				</div>`;
										}
									}
									detailHtml += `<li>
				                    				<div class="item-tt">
				                					<img src="`+ icon + `"/><span>` + name + `</span><label>` + deduct + `</label>
				                					<p>上期共有`+ unCompleteCount + `个单点测试任务未完成</p>
				                				</div>
				                				`+ taskListHtml + `
				                			</li>`;
								} else if (objid == 8) {//人员资质
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
	                                    <img style="width:22px;height:22px;" src="`+ icon + `"/>
	                                        <div>
	                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
	                                        <p class="level2-item-des">`+ desc + `</p>
	                                    </div></li>`;
								} else if (objid == 9) {//安全制度管理
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
	                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
	                                        <div>
	                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
	                                        <p class="level2-item-des">`+ desc + `</p>
	                                    </div></li>`;
								} else if (objid == 10) {//应急预案
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
	                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
	                                        <div>
	                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
	                                        <p class="level2-item-des">`+ desc + `</p>
	                                    </div></li>`;
								} else if (objid == 11) {//建筑防火
									detailHtml += `<li>
			                                    <img style="width:22px;height:22px;" src="`+ icon + `"/>
			                                        <div>
			                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
			                                        <p class="level2-item-des">`+ title + `</p>
			                                    </div></li>`;
								} else if (objid == 12) {//建筑材料隐患
									++indexItem;
									detailHtml += `<li style="padding-bottom: 19px;">
				        	        				<div class="item-tt">
				    	        					<img style="width:22px;height:22px;" src="`+ icon + `"/><span>` + name + `</span><label>` + deduct + `</label>
				    	        					<p>`+ title + `</p>
				    	        				</div>`;
									if (deductDetails.length > 0) {
										detailHtml += `<div id="item_swiper_` + majorGroupId + '_' + indexItem + `_` + objid + `"  class="swiper-container swiper-video" ><div class="swiper-wrapper">`;
									}

									for (var j = 0; j < deductDetails.length; j++) {
										var deductDetail = deductDetails[j];
										var level3Deduct = deductDetail.deduct;
										if (level3Deduct == 0) {
											level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
										} else {
											level3Deduct = "-" + level3Deduct;
										}
										detailHtml += `<div class="swiper-slide" style="background-color: transparent;">
											    	<div class="item-video">
							        					<img src="`+ deductDetail.picUrls + `"/>
							        					<div class="item-void-tt"><span>`+ deductDetail.gradeName + `</span><label>` + level3Deduct + `</label></div>
							        					<p class="item-void-des">`+ deductDetail.hiddenDangerDesc + `</p>
							        				</div>
											    </div>`;
									}
									if (deductDetails.length > 0) {
										detailHtml += `</div>
		          							  <div class="line"></div>
		        							  <div class="swiper-pagination" id="item_pagination_`+ majorGroupId + '_' + indexItem + `_` + objid + `"  style="bottom:3px"></div>
		        							</div>`;
									}
									detailHtml += `</li>`;
								} else if (objid == 13) {//安全出口堵塞分析
									++indexItem;
									detailHtml += `<li style="padding-bottom: 19px;">
				        	        				<div class="item-tt">
				    	        					<img src="`+ icon + `"/><span>` + name + `</span><label>` + deduct + `</label>
				    	        					<p>`+ title + `</p>
				    	        				</div>`;
									if (deductDetails.length > 0) {
										detailHtml += `<div  id="item_swiper_` + majorGroupId + '_' + indexItem + `_` + objid + `"  class="swiper-container swiper-init demo-swiper swiper-video" ><div class="swiper-wrapper">`;
									}
									for (var j = 0; j < deductDetails.length; j++) {
										var deductDetail = deductDetails[j];
										var level3Deduct = deductDetail.deduct;
										if (level3Deduct == 0) {
											level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
										} else {
											level3Deduct = "-" + level3Deduct;
										}
										detailHtml += `<div class="swiper-slide" style="background-color: transparent;">
											    	<div class="item-video">
							        					<img src="`+ deductDetail.picUrl + `"/>
							        					<span class="lookVideo">查看监控</span>
							        					<div class="item-void-tt"><span>`+ deductDetail.name + `</span><label>` + level3Deduct + `</label></div>
							        					<p class="item-void-des">`+ deductDetail.keepTime + `</p>
							        				</div>
											    </div>`;
									}
									if (deductDetails.length > 0) {
										detailHtml += `</div>
				          							  <div class="line"></div>
				        							  <div class="swiper-pagination" id="item_pagination_`+ majorGroupId + '_' + indexItem + `_` + objid + `"  style="bottom:3px"></div>
				        							</div>`;
									}
									detailHtml += `</li>`;
								} else if (objid == 14 || objid == 15 || objid == 16 || objid == 17) {//14.消防电梯   15.应急照明和疏散指示系统   16.消防应急广播    17.消防系统
									detailHtml += `<li><div class="item-tt"><img  style="width:22px;height:22px;" src="` + icon + `"/><span class="font-size14">` + name + `</span><label>` + deduct + `</label></div>`;
									for (var j = 0; j < deductDetails.length; j++) {
										var deductDetail = deductDetails[j];
										var level3Deduct = deductDetail.deduct;
										if (level3Deduct == 0) {
											level3Deduct = "<label style='color:#69BA71'><i class='iconfont icon-duigou'></i></label>";
										} else {
											level3Deduct = "-" + level3Deduct;
										}

										//报警类型 10：报警，20：故障，30：屏蔽，40：联动
										if (deductDetail.fireTType == 10) {
											detailHtml += `<div class="item-des"><span style="color:#E17C68">报警</span><span class="desc">` + deductDetail.desc + `</span><label>` + level3Deduct + `</label></div>`;
										} else if (deductDetail.fireTType == 20) {
											detailHtml += `<div class="item-des"><span style="color:#FECE5C">故障</span><span class="desc">` + deductDetail.desc + `</span><label>` + level3Deduct + `</label></div>`;
										} else if (deductDetail.fireTType == 30) {
											detailHtml += `<div class="item-des"><span style="color:#E17C68">屏蔽</span><span class="desc">` + deductDetail.desc + `</span><label>` + level3Deduct + `</label></div>`;
										} else if (deductDetail.fireTType == 40) {
											detailHtml += `<div class="item-des"><span style="color:#4A86CF">联动</span><span class="desc">` + deductDetail.desc + `</span><label>` + level3Deduct + `</label></div>`;
										}
									}
									detailHtml += "</li>";
								} else if (objid == 18) {//18:建筑物年龄  
									var fbsAge = deductDetails.length == 0 ? "" : deductDetails[0].fbsAge + "年";
									detailHtml += `<li>
                                                <img style="width:22px;height:22px;" src="`+ icon + `"/>
                                                <div>
                                                    <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
                                                    <p class="level2-item-des">`+ fbsAge + `</p>
                                                </div></li>`;
								} else if (objid == 19) {// 19:火险气象等级
									var grade = deductDetails.length == 0 ? "" : deductDetails[0].grade + "级";
									detailHtml += `<li>
                                                <img style="width:22px;height:22px;"src="`+ icon + `"/>
                                                <div>
                                                    <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
                                                    <p class="level2-item-des">`+ grade + `</p>
                                                </div></li>`;
								} else if (objid == 20) {// 20消防备案
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
			                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
			                                        <div>
			                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
			                                        <p class="level2-item-des">`+ desc + `</p>
			                                    </div></li>`;
								} else if (objid == 21) {// 21安全管理人
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
                                        <div>
                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
                                        <p class="level2-item-des">`+ desc + `</p>
                                    </div></li>`;
								} else if (objid == 22) {// 22安全责任人
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
                                        <div>
                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
                                        <p class="level2-item-des">`+ desc + `</p>
                                    </div></li>`;
								} else if (objid == 23) {// 22自动消防系统
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
                                        <div>
                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
                                        <p class="level2-item-des">`+ desc + `</p>
                                    </div></li>`;
								} else if (objid == 24) {// 24系统完好率
									var desc = deductDetails.length == 0 ? "" : deductDetails[0].desc;
									detailHtml += `<li>
                                    <img style="width:22px;height:22px;"src="`+ icon + `"/>
                                        <div>
                                        <p class="level2-item-tt">`+ name + `<span>` + deduct + `</span></p>
                                        <p class="level2-item-des">`+ desc + `</p>
                                    </div></li>`;
								}
							}
							if (detailHtml == "<ul class='level2ui'>" || detailHtml == "") {
								detailHtml += "</ul>";
								if (detailHtml == "" || detailHtml == "<ul class='level2ui'></ul>") {
									detailHtml == "";
								}
							} else {
								detailHtml += `<li class="hideView" id="hideGroupBtn` + majorGroupId + `">收起<i class="iconfont icon-shouqi-copy"></i></li></ul>`;
							}
						}
						$("#soleKanban_dataList "+'#groupDiv'+majorGroupId+' .unit-des').text(majorTitle)
						$("#soleKanban_dataList "+'#groupDiv'+majorGroupId).append(detailHtml)
						// $("#soleKanban_dataList").append(`
						// 	<li class="unit" id="groupDiv`+ majorGroupId + `">
						// 		`+ titleHtml + `
						// 		`+ detailHtml + `
						// 	</li>
						// `);
						jQuery("#groupDiv" + majorGroupId).off('click').on('click', { 'data': majorGroupId }, function (e) {
							self.showDetail(e.data.data);
							return false;//阻止事件冒泡
						});
						jQuery("#groupTitleDiv" + majorGroupId).off('click').on('click', { 'data': majorGroupId }, function (e) {
							self.onTitle(e.data.data);
							return false;//阻止事件冒泡
						});

						jQuery("#hideGroupBtn" + majorGroupId).off('click').on('click', { 'data': majorGroupId }, function (e) {
							self.hideDetail(e.data.data);
							return false;//阻止事件冒泡
						});
					}
					self.initChartsList();
					//self.hideTop();
				});
			},
			initChart: function (value, charNameId) {
				var myChart = echarts.init(document.getElementById(charNameId));
				option = {
					color: ['#2471CA', '#F1F1F1'],
					series: [{
						name: '',
						type: 'pie',
						radius: ['90%', '80%'],
						center: ['50%', '45%'],
						avoidLabelOverlap: false,
						label: {
							normal: {
								show: false,
								position: 'center'
							},
							emphasis: {
								show: true,
								textStyle: {
									fontSize: '30',
									fontWeight: 'bold'
								}
							}
						},
						labelLine: {
							normal: {
								show: false
							}
						},
						data: [{
							value: value,
							name: ''
						},
						{
							value: 100 - value,
							name: ''
						},
						]
					}]
				};
				myChart.setOption(option, true);
			},
			hideDetail: function (id) {
				var self = this;
				jQuery("#groupUl" + id).slideUp(500);
				//jQuery("#groupUl"+id).slideUp(500,function() {self.hideTop()});
			},
			showDetail: function (id) {
				var self = this;
				let cId = id;
				jQuery("#groupUl" + id).slideDown(500, function (e) {
					//加载轮播图
					self.initSwiperSlider(cId);
					//加载图表
					self.initChartsList();
					jQuery("#groupUl" + cId).find(".item-video img").off().click(function (e) {
						let imgElArr = jQuery("#groupUl" + cId).find(".item-video img");
						let currentTagPic = e.currentTarget.src;
						let picArr = [];
						jQuery.each(imgElArr, function (index, val) {
							picArr.push(val.src);
						});
						let currentIndex = picArr.indexOf(currentTagPic);
						openAndShowBigImage(picArr, currentIndex);
						e.stopPropagation();
					});
				});
				//jQuery("#groupUl"+id).slideDown(500,function() {self.hideTop()});
			},
			onTitle: function (id) {
				var self = this;
				let cId = id;
				if (jQuery("#groupUl" + id).is(':hidden')) {
					jQuery("#groupUl" + id).slideDown(500, function (e) {
						//加载轮播图
						self.initSwiperSlider(cId);
						//加载图表
						self.initChartsList();
						jQuery("#groupUl" + cId).find(".item-video img").off().click(function (e) {
							let imgElArr = jQuery("#groupUl" + cId).find(".item-video img");
							let currentTagPic = e.currentTarget.src;
							let picArr = [];
							jQuery.each(imgElArr, function (index, val) {
								picArr.push(val.src);
							});
							let currentIndex = picArr.indexOf(currentTagPic);
							openAndShowBigImage(picArr, currentIndex);
							e.stopPropagation();
						});
					});
				} else {
					jQuery("#groupUl" + id).slideUp(500);
				}
			},
			getColorByScore: function (score, getRgba) {
				let fixScore = parseFloat(parseFloat(score).toFixed(1));
				//风险
				if (79.9 < fixScore && fixScore < 89.9) {
					return getRgba ? 'scoreView-warning' : "危险，需及时整改"
				}
				else if (fixScore < 80) {//高危
					return getRgba ? 'scoreView-high-risk' : "告急，请及时处理"
				}
				else {//安全
					return getRgba ? 'scoreView-security' : "安全，请继续保持"
				}
			},
			getColorBg: function (score) {
				jQuery(".soleKanban-top-t").removeClass("red-top red-bot yellow-top yellow-bot green-top green-bot");
				jQuery("#rightScoreNum").html("");
				let fixScore = parseFloat(parseFloat(score).toFixed(1));
				//风险
				if (79.9 < fixScore && fixScore < 89.9) {
					jQuery(".soleKanban-top-t.t").addClass('yellow-top');
					jQuery(".soleKanban-top-t.b").addClass('yellow-bot');
					jQuery("#scoreDesc").css("color", "rgb(180, 140, 41)");
					jQuery("#rightScoreNum").css("color", "#F5B820");
				}
				//高危
				else if (fixScore < 80) {
					jQuery(".soleKanban-top-t.t").addClass('red-top');
					jQuery(".soleKanban-top-t.b").addClass('red-bot');
					jQuery("#scoreDesc").css("color", "#93402B");
					jQuery("#rightScoreNum").css("color", "#FA6C4D");
				}
				//安全
				else {
					jQuery(".soleKanban-top-t.t").addClass('green-top');
					jQuery(".soleKanban-top-t.b").addClass('green-bot');
					jQuery("#scoreDesc").css("color", "#24812E");
					jQuery("#rightScoreNum").css("color", "#6BCA75");
				}
			},
			//初始化圆形任务进度
			initChartsList: function () {
				var self = this;
				var chartsList = $("[id^='mCharts_']");
				for (var i = 0; i < chartsList.length; i++) {
					var chartId = $(chartsList[i]).attr("id");
					self.initChart(parseInt(chartId.split("_")[2]), chartId);
				}
			},
			//初始化滑动切换
			initSwiperSlider: function (id) {
				var self = this;
				if (!self.swipeBox[id]) {
					var swiperList = $("[id^='item_swiper_" + id + "_']");
					for (var i = 0; i < swiperList.length; i++) {
						var swiperId = $(swiperList[i]).attr("id");
						var hiddenCheck_swiper = new Swiper('#item_swiper_' + id + '_' + swiperId.split("_")[3] + '_' + swiperId.split("_")[4], {
							direction: 'horizontal',
							loop: false,
							// autoplay: 3000,
							// slidesPerView: "auto",
							// centeredSlides: true,
							spaceBetween: 10,
							pagination: {
								el: '#item_pagination_' + id + '_' + swiperId.split("_")[3] + '_' + swiperId.split("_")[4],
								dynamicBullets: true,
							},
						});
					}
				}
				//只有一个不需要下面的点
				var swPageList = $("[id^='item_pagination_']");
				for (var i = 0; i < swPageList.length; i++) {
					let swaiperList1 = jQuery(swPageList[i]).children();
					if (swaiperList1.length == 1) {
						//清除圆点
						jQuery(swPageList[i]).empty();
						//禁止图片拖动
						jQuery(swPageList[i]).parent().addClass("swiper-no-swiping");
					}
				}
				self.swipeBox[id] = true
			},
			explainTip: function (type) {
				var self = this;
				if (type == 1){
					Dao.getSafetyGroupMaxScore({
						orgId: self.singleOrgId,
					}, function (res) {
						let item = ""
						for(let i=0;i<res.length;i++){
							item+=`<p class="content"><leble class="yuandian"></leble><span style="font-weight: bold;">`+res[i].groupName+`</span><span class="float_right" style="font-weight: bold;">`+res[i].maxScore+`</span></p>`
						}
						var html = `
						<div class="popup selectOptionFn-popup" style="height: 80vh !important;overflow-y: scroll;">
							<div class="evaluationBasis evaluationBasi"><span>评估申明</span></div>
							<div class="evaluationBasis scheme-assessment"><span>【评估依据】</span></div>
							<div class="content" style="text-indent: 35px;text-align: justify;">本评估依据中华人民共和国消防法（2019）、消防安全责任制实施办法、人员密集场所消防安全评估导则（ GA/T1369-2016）等法规，采用层次分析法，通过对监测数据进行整合、抽离、赋权进行评估。</div>
							<div class="evaluationBasis scheme-assessment"><span>【评估方案】</span></div>
							<div class="content" style="text-indent: 35px;text-align: justify;">系统从消防设施单元、安全疏散设施单元、消防安全管理单元、建筑防火单元、客观情况以及直接判定项这6个维度对单位的消防安全状况进行实时评分。评分采用扣分制。总分上限为100.各单元扣分上限如下：</div>
						` + item + `</div>`
						creatNewPopup(html, function () {

						});
					})
				}
				if (type == 2) {
					var html = `
                      	<div class="popup selectOptionFn-popup" style="height: 377px !important;">
                		 <div class="evaluationBasis evaluationBasi"><span>免责申明</span></div>
                  		<div class="content"><div><leble class="yuandian"></leble><div class="left20">本评估虽按照相关法律法规指定，相对传统评估更具实时性优势，但仍然不能取代传统的线下人工评估。如不能监测到防火分区的完整性等。</div></div></div>
                  		<div class="content"><div><leble class="yuandian"></leble><div class="left20">单位不应该过度依赖于本评估，着眼于单位的现场、实时情况，按照相关法规要求进行严格管理是非常必要的。</div></div></div>
                  	</div>`;
					creatNewPopup(html, function () {

					});
				}
			},
			hideTop: function () {
				var self = this;
				var groupDetailList = $("[id^='groupUl']");
				var flg = true;
				for (var i = 0; i < groupDetailList.length; i++) {
					if ($(groupDetailList[i]).css("display") != 'none') {
						flg = false;//有一个显示就是false;
					}
				}
				if (flg) {
					//显示top 图片
					jQuery("#topPlan").slideDown(1000);
					$(".top-one").hide();
					$(".top-two").show();
				} else {
					jQuery("#topPlan").slideUp(1000);
					$(".top-one").show();
					$(".top-two").hide();
				};
			},
			handleScroll: function () {
				var rdsp_page_scroll = "#kanban-page-content";
				$(rdsp_page_scroll).scroll(function () {
					if ($(this).scrollTop() > 300) {
						jQuery("#topPlan").slideUp(1000);
						$(".top-one").hide();
						$(".top-two").show();
					}
					if ($(this).scrollTop() < 10) {
						jQuery("#topPlan").slideDown(1000);
						$(".top-one").show();
						$(".top-two").hide();
					}
				});
			},
		},
		on: {
			pageInit: function (e, page) {
				var self = this;
				//从多单位切换过来
				if (single_Orgid && single_OrgName && userInfor.isMuilUnitUser) {
					$('#btn_soleKanbanBack').show()
					self.singleOrgId = single_Orgid;
					$("#orgName_soleKanban").html(single_OrgName);
					$("#orgNameTitle2").html(single_OrgName);
				} else {
					$('#btn_soleKanbanBack').hide()
					self.singleOrgId = userInfor.organizationIds;
					$("#orgName_soleKanban").html(userInfor.org.name);
					$("#orgNameTitle2").html(single_OrgName);
				}
				self.getScoreItemDetail();
				self.handleScroll();

				//window.getCards_homeSingle = self.refreshCards;

				//获取应用版本
				if (app.data.isFirstLoad) {
					app.data.isFirstLoad = false;
					//公共資源
					getPublicReouse();
				}
				common.loading(0);
			},
		}
	}
</script>
<style>
	.bgTop {
		z-index: 15;
		opacity: 0.5;
	}

	.bgMiddle {
		z-index: 10;
		opacity: 0.75;
	}

	.bgBottom {
		z-index: 5;
	}
</style>